#ifndef __CACHE_H__
#define __CACHE_H__

#include "common.h"

#define E 8 // way
#define CACHE_SET CACHE_SIZE / E / CACHE_BLOCK // set size
#define CACHE_BLOCK 64 // cache block size
#define CACHE_SIZE 64*1024 //cache size


struct cache_l1 {
   bool valid; // 1 byte, 8 bit
    int tag; // 4 byte, 32 bit
    uint8_t byte[CACHE_BLOCK]; // (8 bit) 1 byte * 64 = 64 byte
} cache[CACHE_SIZE / CACHE_BLOCK];

uint64_t cnt;

void init_cache();
uint32_t cache_read(hwaddr_t addr);
void cache_write(hwaddr_t addr,size_t len,uint32_t data);

#endif